package com.sailfish.springbootdemo.controller.db1;

import com.sailfish.springbootdemo.pojo.Result;
import com.sailfish.springbootdemo.pojo.db1.PcbaCompany;
import com.sailfish.springbootdemo.pojo.db1.PcbaWorkshop;
import com.sailfish.springbootdemo.service.db1.PcbaCompanyService;
import com.sailfish.springbootdemo.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/pcbaCompany")
public class PcbaCompanyController {

    @Autowired
    private PcbaCompanyService pcbaCompanyService;

    @PostMapping("/getAllCompany")
    public Result getAllCompany(String searchValue) {
        return pcbaCompanyService.getAllCompany(searchValue);
    }

    @PostMapping("/deleteCompanyAndWorkshop")
    public Result deleteCompanyAndWorkshop(Integer pcbaCompanyId) {
        return pcbaCompanyService.deleteCompanyAndWorkshop(pcbaCompanyId);
    }

    @PostMapping("/addOrUpdatePcbaCompany")
    public Result addOrUpdatePcbaCompany(String mode, PcbaCompany pcbaCompany) {
        return pcbaCompanyService.addOrUpdatePcbaCompany(mode, pcbaCompany);
    }

    @PostMapping("/updateEmailOwners")
    public Result updateEmailOwners(Integer pcbaCompanyId, String emailOwners) {
        return pcbaCompanyService.updateEmailOwners(pcbaCompanyId, emailOwners);
    }

    @PostMapping("/updateEmailOwners2")
    public Result updateEmailOwners2(Integer pcbaCompanyId, String emailOwners2) {
        return pcbaCompanyService.updateEmailOwners2(pcbaCompanyId, emailOwners2);
    }

    @PostMapping("/updateEmailOwners3")
    public Result updateEmailOwners3(Integer pcbaCompanyId, String emailOwners3) {
        return pcbaCompanyService.updateEmailOwners3(pcbaCompanyId, emailOwners3);
    }

    @PostMapping("/updateEmailOwners4")
    public Result updateEmailOwners4(Integer pcbaCompanyId, String emailOwners4) {
        return pcbaCompanyService.updateEmailOwners4(pcbaCompanyId, emailOwners4);
    }

    @PostMapping("/updateEmailOwners5")
    public Result updateEmailOwners5(Integer pcbaCompanyId, String emailOwners5) {
        return pcbaCompanyService.updateEmailOwners5(pcbaCompanyId, emailOwners5);
    }

    @PostMapping("/updateEmailOwners6")
    public Result updateEmailOwners6(Integer pcbaCompanyId, String emailOwners6) {
        return pcbaCompanyService.updateEmailOwners6(pcbaCompanyId, emailOwners6);
    }
}
